package com.portico.dept.solarch

import grails.plugins.springsecurity.Secured

@Secured(['ROLE_SA_ADMIN', 'ROLE_SA_USER'])
class DashboardController {

  static defaultAction = "projectDashboard"

  def index = { }

  def weeklyProjectStatus = {
    [projectStatus: ProjectStatus.findByStatusDateBetween(new Date() - 7, new Date())];
  }

  def projectDashboard = {
    [view: "projectDashboard", model: [projectDashboardInstanceList: ProjectDashboard.list(params),
            projectDashboardInstanceTotal: ProjectDashboard.count()]]
  }
  def projectQualityTrend = {
    String issueStatus = params.issueStatus;
    if (issueStatus == null || issueStatus.equalsIgnoreCase("")) {
      params.issueStatus = "ALL";
    }
    [projectQualityInstanceList: ProjectQuality.list(params), issueType: params.issueStatus];
  }


}
